package com.sky.orangehireserver.common.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 职位表（扩展版，支持招聘流程与岗位信息展示）
 * @TableName jobs
 */
@TableName(value ="jobs")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Jobs implements Serializable {
    /**
     * 职位ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 所属企业ID
     */
    @TableField(value = "org_id")
    private Long orgId;

    /**
     * 职位名称
     */
    @TableField(value = "title")
    private String title;

    /**
     * 所属部门
     */
    @TableField(value = "department")
    private String department;

    /**
     * 工作地点/城市
     */
    @TableField(value = "location")
    private String location;

    /**
     * 工作类型: full_time/part_time/intern/contract
     */
    @TableField(value = "employment_type")
    private String employmentType;

    /**
     * 经验要求: junior/mid/senior
     */
    @TableField(value = "seniority")
    private String seniority;

    /**
     * 学历要求: bachelor/master/phd/none
     */
    @TableField(value = "education")
    private String education;

    /**
     * 最低薪资
     */
    @TableField(value = "salary_min")
    private BigDecimal salaryMin;

    /**
     * 最高薪资
     */
    @TableField(value = "salary_max")
    private BigDecimal salaryMax;

    /**
     * 货币类型
     */
    @TableField(value = "currency")
    private String currency;

    /**
     * 职位状态: draft/open/closed
     */
    @TableField(value = "status")
    private String status;

    /**
     * 职位负责人ID（企业用户）
     */
    @TableField(value = "owner_id")
    private Long ownerId;

    /**
     * 职位描述
     */
    @TableField(value = "description")
    private String description;

    /**
     * 任职要求/技能要求
     */
    @TableField(value = "requirements")
    private String requirements;

    /**
     * 岗位职责
     */
    @TableField(value = "responsibilities")
    private String responsibilities;

    /**
     * 福利待遇
     */
    @TableField(value = "benefits")
    private String benefits;

    /**
     * 职位标签/关键词，用逗号分隔
     */
    @TableField(value = "tags")
    private String tags;

    /**
     * 职位浏览次数
     */
    @TableField(value = "views_count")
    private Integer viewsCount;

    /**
     * 投递次数
     */
    @TableField(value = "applications_count")
    private Integer applicationsCount;

    /**
     * 创建时间
     */
    @TableField(value = "created_at")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at")
    private LocalDateTime updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Jobs other = (Jobs) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getOrgId() == null ? other.getOrgId() == null : this.getOrgId().equals(other.getOrgId()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getDepartment() == null ? other.getDepartment() == null : this.getDepartment().equals(other.getDepartment()))
            && (this.getLocation() == null ? other.getLocation() == null : this.getLocation().equals(other.getLocation()))
            && (this.getEmploymentType() == null ? other.getEmploymentType() == null : this.getEmploymentType().equals(other.getEmploymentType()))
            && (this.getSeniority() == null ? other.getSeniority() == null : this.getSeniority().equals(other.getSeniority()))
            && (this.getEducation() == null ? other.getEducation() == null : this.getEducation().equals(other.getEducation()))
            && (this.getSalaryMin() == null ? other.getSalaryMin() == null : this.getSalaryMin().equals(other.getSalaryMin()))
            && (this.getSalaryMax() == null ? other.getSalaryMax() == null : this.getSalaryMax().equals(other.getSalaryMax()))
            && (this.getCurrency() == null ? other.getCurrency() == null : this.getCurrency().equals(other.getCurrency()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getOwnerId() == null ? other.getOwnerId() == null : this.getOwnerId().equals(other.getOwnerId()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getRequirements() == null ? other.getRequirements() == null : this.getRequirements().equals(other.getRequirements()))
            && (this.getResponsibilities() == null ? other.getResponsibilities() == null : this.getResponsibilities().equals(other.getResponsibilities()))
            && (this.getBenefits() == null ? other.getBenefits() == null : this.getBenefits().equals(other.getBenefits()))
            && (this.getTags() == null ? other.getTags() == null : this.getTags().equals(other.getTags()))
            && (this.getViewsCount() == null ? other.getViewsCount() == null : this.getViewsCount().equals(other.getViewsCount()))
            && (this.getApplicationsCount() == null ? other.getApplicationsCount() == null : this.getApplicationsCount().equals(other.getApplicationsCount()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOrgId() == null) ? 0 : getOrgId().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getDepartment() == null) ? 0 : getDepartment().hashCode());
        result = prime * result + ((getLocation() == null) ? 0 : getLocation().hashCode());
        result = prime * result + ((getEmploymentType() == null) ? 0 : getEmploymentType().hashCode());
        result = prime * result + ((getSeniority() == null) ? 0 : getSeniority().hashCode());
        result = prime * result + ((getEducation() == null) ? 0 : getEducation().hashCode());
        result = prime * result + ((getSalaryMin() == null) ? 0 : getSalaryMin().hashCode());
        result = prime * result + ((getSalaryMax() == null) ? 0 : getSalaryMax().hashCode());
        result = prime * result + ((getCurrency() == null) ? 0 : getCurrency().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getOwnerId() == null) ? 0 : getOwnerId().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getRequirements() == null) ? 0 : getRequirements().hashCode());
        result = prime * result + ((getResponsibilities() == null) ? 0 : getResponsibilities().hashCode());
        result = prime * result + ((getBenefits() == null) ? 0 : getBenefits().hashCode());
        result = prime * result + ((getTags() == null) ? 0 : getTags().hashCode());
        result = prime * result + ((getViewsCount() == null) ? 0 : getViewsCount().hashCode());
        result = prime * result + ((getApplicationsCount() == null) ? 0 : getApplicationsCount().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", orgId=").append(orgId);
        sb.append(", title=").append(title);
        sb.append(", department=").append(department);
        sb.append(", location=").append(location);
        sb.append(", employmentType=").append(employmentType);
        sb.append(", seniority=").append(seniority);
        sb.append(", education=").append(education);
        sb.append(", salaryMin=").append(salaryMin);
        sb.append(", salaryMax=").append(salaryMax);
        sb.append(", currency=").append(currency);
        sb.append(", status=").append(status);
        sb.append(", ownerId=").append(ownerId);
        sb.append(", description=").append(description);
        sb.append(", requirements=").append(requirements);
        sb.append(", responsibilities=").append(responsibilities);
        sb.append(", benefits=").append(benefits);
        sb.append(", tags=").append(tags);
        sb.append(", viewsCount=").append(viewsCount);
        sb.append(", applicationsCount=").append(applicationsCount);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}